var page = require('webpage').create(),
    system = require('system'),
    address = system.args[1];

page.open(address, function(status) {
    if (status !== 'success') {
    } else {
        var sites = page.evaluate(function () {
            var infolist = document.querySelectorAll('div.info>h3>a');
            var ret = new Array;
            for (var i = 0, len = infolist.length; i < len; ++ i){
                var node = infolist[i];
                var url = 'http://' + node.nextSibling.innerText;
                ret.push([node.title, url]);
            }
            return ret;
        });
        for (var i = 0, len = sites.length; i < len; ++ i){
            console.log('yes ' + sites[i][0] + ' ' + sites[i][1]);
        }
        phantom.exit();
    }
});

setTimeout(function(){
    phantom.exit();
}, 100000);

